'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.prefix('/api/v1');//设置基础路径

  // console.log(Object.getOwnPropertyNames(router));
  // console.log(router);
  // console.dir(router)

  //用户注册
  router.post('/users/reg', controller.user.reg);
  //用户登录
  router.post('/users/login', controller.user.login);
  //用户退出
  router.post('/users/logout', controller.user.logout);

  //文件上传
  router.post("/files/upload", controller.file.upload);
  //剩余容量
  router.get("/files/getsize", controller.file.getSize);
  //文件列表
  router.get("/files/list", controller.file.list);
  //创建文件夹
  router.post("/files/createdir", controller.file.createdir);
  //重命名
  router.post("/files/rename", controller.file.rename);
  //批量删除文件
  router.post("/files/delete", controller.file.delete);
  //搜索文件
  router.get("/files/search", controller.file.search);

  //创建分享
  router.post("/shares/create", controller.share.create);
  //分享列表
  router.get("/shares/list", controller.share.list);
  //查看分享
  router.get("/shares/:sharedurl", controller.share.getShare);
  //保存到自己的网盘
  router.post("/shares/save_to_self", controller.share.saveToSelf);
};
